package com.zyy.memento.demo01;

/**
 * @Description: 类描述
 * @Author: zyy
 * @Date: 2023/08/06 16:10
 */
public class Client {
    public static void main(String[] args) {
        System.out.println("------------------大战Boss前----------------");
        GameRole gameRole = new GameRole();
        gameRole.iniState();
        gameRole.stateDisplay();
        //保存进度
        RoleStateMemento roleStateMemento = gameRole.saveState();

        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setRoleStateMemento(roleStateMemento);


        System.out.println("------------------大战Boss后----------------");
        gameRole.fight();
        gameRole.stateDisplay();


        System.out.println("------------------满血复活后----------------");
        gameRole.recoverState(roleStateCaretaker.getRoleStateMemento());
        gameRole.stateDisplay();
    }
}
